﻿<UserControl x:Class="MoneyManagerNET.Presentation.View.TransactionControl"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             d:DesignHeight="298" d:DesignWidth="452"
             
        
       xmlns:vm="clr-namespace:MoneyManagerNET.Presentation.ViewModel;assembly=MoneyManagerNET.Presentation.ViewModel" 
             
       d:DataContext="{x:Static Member=vm:DesignTimeViewModelSupplier.Transaction}"


    >
    <UserControl.Resources>
        
    </UserControl.Resources>
             <Grid ShowGridLines="False">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="2*" />
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="2*" />
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="*" />
            <RowDefinition Height="*" />
            <RowDefinition Height="*" />
            <RowDefinition Height="*" />
            <RowDefinition Height="2*" />

        </Grid.RowDefinitions>

        <Label Content="Transaction Type :   "/>
        <ComboBox ItemsSource="{Binding Path=PossibleTypes}" MinWidth="100" SelectedValue="{Binding Path=TransactionType}" Grid.Column="1"/>


        <Grid Grid.Row="1"  Grid.RowSpan="2" Grid.ColumnSpan="2"  >
            <Grid.RowDefinitions>
                <RowDefinition Height="*"/>
                <RowDefinition Height="*"/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="2*"/>
            </Grid.ColumnDefinitions>

            <Label Content="From:" Visibility="{Binding Path=FromVisible, Converter={StaticResource bool2vis}}" />
            <Button Content="{Binding Path=FromContent}" Visibility="{Binding Path=FromVisible, Converter={StaticResource bool2vis}}" Grid.Column="1" Command="{Binding Path=PromptFromAccountCommand}" />

            <Label Content="To:" Grid.Row="1" Visibility="{Binding Path=ToVisible, Converter={StaticResource bool2vis}}"/>
            <Button Content="{Binding Path=ToContent}"  Grid.Row="1" Grid.Column="1" Visibility="{Binding Path=ToVisible, Converter={StaticResource bool2vis}}" Command="{Binding Path=PromptToAccountCommand}" />


        </Grid>


        <Label Content="{Binding Path=ContragentTitle}" Visibility="{Binding ContragentVisible, Converter={StaticResource bool2vis}, Mode=OneWay}" Grid.Row="3"/>
        <Button  Content="{Binding Path=ContragentContent}" MinWidth="100" Command="{Binding PromptContragentCommand}" Visibility="{Binding ContragentVisible,Converter={StaticResource bool2vis}}" Grid.Row="3" Grid.Column="1"/>

        <Label Content="Category" Grid.Column="2"/>
        <Button  Grid.Column="3" Content="{Binding CategoryContent, ValidatesOnDataErrors=True,ValidatesOnExceptions=True}" Command="{Binding Path=PromptCategoryCommand}" />


        <Label Content="Date" Grid.Column="2" Grid.Row="2"/>
        <DatePicker SelectedDate="{Binding Path=Date,ValidatesOnDataErrors=True,ValidatesOnExceptions=True}" Grid.Column="3" Grid.Row="2"/>


        <Label Content="Status" Grid.Column="2" Grid.Row="3"/>
        <ComboBox ItemsSource="{Binding PossibleStatuses}" SelectedValue="{Binding Status}"  Grid.Column="3" Grid.Row="3"/>

        <Label Content="Amount"  Grid.Row="4" Grid.Column="2"/>
        <TextBox Text="{Binding Path=Amount, NotifyOnValidationError=True,ValidatesOnDataErrors=True,ValidatesOnExceptions=True}" Grid.Row="4" Grid.Column="3"/>


        <Label Content="Notes" Grid.Row="4" />
        <TextBox Grid.Row="4" Grid.Column="1" VerticalAlignment="Stretch" Text="{Binding Notes}"/>
    </Grid>
</UserControl>
